package com.zyr.feign;

import com.zyr.domain.Order;
import com.zyr.feign.fallback.OrderFeignClientFallback;
import com.zyr.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author 张雨润
 * @date 2024/7/28 下午8:09
 * @Description
 */
@FeignClient(name = "order-server",fallback = OrderFeignClientFallback.class)//要调用的远程服务名称nacos
public interface OrderFeignClient {
    @GetMapping("/orders/getOrders/{userId}")
    List<Order> getListByUserId(@PathVariable("userId") long userId);
    @PostMapping("/orders/add")
    boolean add(@RequestBody Order order);
}
